package com.sens.ipc.alipay.application;

import android.content.Context;
import android.content.Intent;

import com.sens.common.Log;
import com.sens.ipc.alipay.Action;
import com.sens.vo.AliPayOrderVo;

public abstract class Handle implements Callback {
    private Context context;

    protected Handle(Context context) {
        this.context = context;
    }

    @Override
    public void addOrder(AliPayOrderVo aliPayOrderVo) {
        Log.i("hook添加订单");
        Intent intent = new Intent(Action.Application.ACTION_ADD_ORDER);
        intent.putExtra(Action.Application.ACTION_ADD_ORDER, aliPayOrderVo);
        context.sendBroadcast(intent);
    }

    @Override
    public void noticeMessage(CharSequence message) {
        Intent intent = new Intent(Action.Application.ACTION_NOTICE_MESSAGE);
        intent.putExtra(Action.Application.ACTION_NOTICE_MESSAGE, message);
        context.sendBroadcast(intent);
    }

    @Override
    public void requestMonitor() {
        context.sendBroadcast(new Intent(Action.Application.ACTION_REQUEST_MONITOR));
    }

    @Override
    public void updateUserId(String userId) {
        Intent intent = new Intent(Action.Application.ACTION_UPDATE_USERID);
        intent.putExtra(Action.Application.ACTION_UPDATE_USERID, userId);
        context.sendBroadcast(intent);
    }

    public abstract void unBind();
}
